
/**
 * created on 2012-05-20
 * @author  qiujz
 * @version 1.0
 *
 * Copyright (c)  Founder Software (Suzhou) Co., Ltd.  2012
 *  All rights reserved.
 *
 * 
 * ================================================================
 * Change Revision
 * ---------------------------------------------------------------
 *    DATE                BY                   COMMENT
 * ---------------------------------------------------------------
 * 2012-05-20         qiujz                Create class
 * 
 *
 * ================================================================
 */	

package com.qjz.dao.impl;

import java.sql.SQLException;
import java.util.List;
import java.util.Map;

import com.ibatis.sqlmap.client.SqlMapClient;
import com.founder.mh.framework.dao.impl.BaseDaoImpl;
import com.qjz.dao.IFunctionOpenDao;
import com.qjz.entity.FunctionOpenTo;	

public class FunctionOpenDaoImpl extends BaseDaoImpl implements IFunctionOpenDao {
	/** 
	 * @inheritDoc
	 * @see com.qjz.dao.IFunctionOpenDao
	 *      #searchFunctionOpenList(java.util.Map)
	 */
	public List<FunctionOpenTo> searchFunctionOpenList(
			Map<String, Object> paramMap) {
		return this.queryForList("functionOpen.searchFunctionOpen", paramMap);
	}

	/** 
	 * @inheritDoc
	 * @see com.qjz.dao.IFunctionOpenDao
	 *      #searchFunctionOpenPagination(java.util.Map, int, int)
	 */
	public List<FunctionOpenTo> searchFunctionOpenPagination(
			Map<String, Object> paramMap, int startRow, int endRow) {
		return this.queryForListPagination("functionOpen.searchFunctionOpen",
				paramMap, startRow, endRow);
	}
	
	/** 
	 * @inheritDoc
	 * @see com.qjz.dao.IFunctionOpenDao
	 *      #getFunctionOpenCount(java.util.Map)
	 */
	public Integer getFunctionOpenCount(Map<String, Object> paramMap) {
		return (Integer) this.queryForObject("functionOpen.getFunctionOpenCount", paramMap);
	}
	
	
	/** 
	 * @inheritDoc
	 * @see com.qjz.dao.IFunctionOpenDao
	 *      #getFunctionOpenByPrimaryKey(int)
	 */
	public FunctionOpenTo getFunctionOpenByPrimaryKey(int foid) {
		return (FunctionOpenTo) queryForObject("functionOpen.getFunctionOpenByPrimaryKey", foid);
	}
	

	/** 
	 * @inheritDoc
	 * @see com.qjz.dao.IFunctionOpenDao
	 *      #insertFunctionOpen(com.qjz.entity.FunctionOpenTo)
	 */
	public Object insertFunctionOpen(FunctionOpenTo functionOpen) {
		return this.create("functionOpen.insertFunctionOpen", functionOpen);		
	}

	/** 
	 * @inheritDoc
	 * @see com.qjz.dao.IFunctionOpenDao
	 *      #updateFunctionOpenByBean(com.qjz.entity.FunctionOpenTo)
	 */
	public int updateFunctionOpenByBean(FunctionOpenTo functionOpen) {
		return this.update("functionOpen.updateFunctionOpen.byBean", functionOpen);
	}

	/** 
	 * @inheritDoc
	 * @see com.qjz.dao.IFunctionOpenDao
	 *      #updateFunctionOpenByProperty(java.util.Map)
	 */
	public int updateFunctionOpenByProperty(Map<String, Object> paramMap) {
		return this.update("functionOpen.updateFunctionOpen.byProperty", paramMap);
	}

	
	/** 
	 * @inheritDoc
	 * @see com.qjz.dao.IFunctionOpenDao
	 *      #deleteFunctionOpenByPrimaryKey(int)
	 */
	public int deleteFunctionOpenByPrimaryKey(int foid) {
		return this.delete("functionOpen.deleteFunctionOpenByPrimaryKey", foid);
	}
	
	/** 
	 * @inheritDoc
	 * @see com.qjz.dao.IFunctionOpenDao
	 *      #deleteFunctionOpenBatch(int[])
	 */
	public void deleteFunctionOpenBatch(int[] keyArray) {
		SqlMapClient sqlMap = this.getSqlMapClient();
		try {
			sqlMap.startBatch();
			for (int key : keyArray) {
				sqlMap.delete("functionOpen.deleteFunctionOpenByPrimaryKey",
						key);
			}
			sqlMap.executeBatch();
		} catch (SQLException e) {
			e.printStackTrace();
		}
	}
	
	public int deleteFunctionOpen(){
		return this.delete("functionOpen.deleteFunctionOpen");
	}
		
}	
	
